﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
	<link href="js-console.css" rel="stylesheet" />
	<!--5. Write a Boolean expression for finding if the bit 3
			(counting from 0) of a given integer is 1 or 0.-->
</head>
<body>
	<div id="js-console"></div>
	<script src="js-console.js"></script>
	<script>
		var number = prompt("Enter integer value");

		if (!isNaN(number)) {
			number *= 1;	// make it real number
			var mask = 1 << 2;
			var result = number & mask;

			var isOne = (result > 0);
			jsConsole.writeLine("Third bit of the number is " + (isOne ? "one" : "zero") + ".");
		}
		else {
			jsConsole.writeLine("Not a Number.");
		}
	</script>
</body>
</html>
